<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body onload="init()">
		<script>			
			var w;
			function init(){
				w=new WebSocket("ws://localhost:8080/nsd_websocket1014/abcd");
				w.onclose=function(){
					console.log("关闭连接")
				}
				w.onerror=function(){
					console.log("发生错误")
				}
				w.onopen=function(){
					console.log("我已成功建立连接")
				}
				w.onmessage=function(e){
					
				}
			}
			function sendmessage(){
				var  t1=document.getElementById("t1").value;
				w.send(t1);
				
				
			}
			
		</script>
		<input type="text"  id="t1" /> <button onclick="sendmessage()">ok</button>
		
		
		
		
		
		
	</body>
</html>
